﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

/// <summary>
///BaseEditShowField 的摘要说明
/// </summary>
public abstract class BaseEditShowField:IEditShowField
{
	public BaseEditShowField()
	{
		//
		//TODO: 在此处添加构造函数逻辑
		//
	}

    public abstract IEnumerable<Control> GetThisTypeControl(ConfigColumns cCol, string value, bool isEdit);

    #region IEditShowField 成员

    public IEnumerable<System.Web.UI.Control> GetEditFieldControls(ConfigColumns cCol, string value, bool isEdit)
    {
        Table tab = new Table();
        tab.CssClass = "EditTable";
        TableRow row = new TableRow();
        tab.Rows.Add(row);
        TableCell left = new TableCell();
        TableCell right = new TableCell();
        left.CssClass = "LeftCell";
        right.CssClass = "RightCell";
        row.Cells.Add(left);
        row.Cells.Add(right);
        Literal lit = new Literal();
        lit.Text = cCol.EditShowName;

        left.Controls.Add(lit);

        foreach (Control ctrl in GetThisTypeControl(cCol, value, isEdit))
        {
            right.Controls.Add(ctrl);
        }

        yield return tab;
    }

    #endregion
}
